using System;
using System.Collections.Generic;

namespace Rob.SampleCode.MyApp.Core.Domain
{
    public class Order
    {
        public Order()
        {
            _orderDetails = new List<OrderDetail>();
        }

        private readonly IList<OrderDetail> _orderDetails;

        public virtual int OrderID { get; set; }
        public virtual DateTime? OrderDate { get; set; }
        public virtual DateTime? RequiredDate { get; set; }
        public virtual DateTime? ShippedDate { get; set; }
        public virtual decimal? Freight { get; set; }
        public virtual string ShipName { get; set; }
        public virtual string ShipAddress { get; set; }
        public virtual string ShipCity { get; set; }
        public virtual string ShipRegion { get; set; }
        public virtual string ShipPostalCode { get; set; }
        public virtual string ShipCountry { get; set; }
        public virtual Customer Customer { get; set; }
        public virtual Employee Employee { get; set; }
        public virtual Shipper Shipper { get; set; }
        public virtual IEnumerable<OrderDetail> OrderDetails
        {
            get { return _orderDetails; }
        }

        public virtual void AddDetail(Product product, decimal unitPrice, short quantity, float discount)
        {
            _orderDetails.Add(new OrderDetail(this, product, unitPrice, quantity, discount));
        }
    }
}